package cn.kmsoft.spatialboot.service;


import cn.kmsoft.wololo.object.GeoJson;
import cn.kmsoft.wololo.object.query.GeoJsonQuery;
import cn.kmsoft.wololo.object.query.TableQuery;
import cn.kmsoft.spatialboot.common.object.StatsParams;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 空间分析服务接口
 *
 * @author
 * @date 2019/7/4.
 */
public interface SpatialAnalysisService {
    /**
     * 空间查询
     *
     * @param instanceName 实例名
     * @param tableId      表ID
     * @param query        空间查询信息
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    GeoJson[] spatialQueryByGeoJson(String dbType,String instanceName, String tableId, GeoJsonQuery query, String targetGeoType) throws ExecutionException, InterruptedException;

    /**
     * 空间相交
     *
     * @param instanceName 实例名
     * @param tableId      表ID
     * @param query        空间查询信息
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    GeoJson[] intersectByGeoJson(String dbType,String instanceName, String tableId, GeoJsonQuery query, String targetGeoType) throws ExecutionException, InterruptedException;

    /**
     * 空间相交
     *
     * @param instanceName 实例名
     * @param query        表叠加查询
     * @return
     */
    GeoJson[] intersectByTable(String dbType,String instanceName, TableQuery query);

    /**
     * 空间擦除
     *
     * @param instanceName 实例名
     * @param tableId      表ID
     * @param query        空间查询信息
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    GeoJson[] differenceByGeoJson(String dbType,String instanceName, String tableId, GeoJsonQuery query) throws ExecutionException, InterruptedException;

    /**
     * 空间擦除
     *
     * @param instanceName 实例名
     * @param query        表叠加查询
     * @return
     * @throws ExecutionException
     * @throws InterruptedException
     */
    GeoJson[] differenceByTable(String dbType,String instanceName, TableQuery query) throws ExecutionException, InterruptedException;

    /**
     * 统计
     *
     * @param instanceName 实例名
     * @param statsParams  统计参数
     * @return
     */
    List<Map<String, Object>> stat(String instanceName, StatsParams statsParams);

}
